Skip to content

GH-50803: [CI][Dev] Fix shellcheck errors in the ci/scripts/r_windows_build.sh - #50818

Merged
kou merged 1 commit into
apache:mainfrom
hiroyuki-sato:topic/shellcheck-r_windows_build
Aug 6, 2026
Merged

GH-50803: [CI][Dev] Fix shellcheck errors in the ci/scripts/r_windows_build.sh#50818
kou merged 1 commit into
apache:mainfrom
hiroyuki-sato:topic/shellcheck-r_windows_build

Conversation

@hiroyuki-sato

@hiroyuki-sato hiroyuki-sato commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Rationale for this change

This is the sub issue #44748.

  • SC2011: Use find -print0 or find -exec to better handle non-alphanumeric filenames.
  • SC2034: foo appears unused. Verify it or export it.
  • SC2035: Use ./*glob* or -- *glob* so names with dashes won't become options.
  • SC2046: Quote this to prevent word splitting.
  • SC2086: Double quote to prevent globbing and word splitting.
  • SC2155: Declare and assign separately to avoid masking return values.
  • SC2223: This default assignment may cause DoS due to globbing. Quote it.
shellcheck ci/scripts/r_windows_build.sh

In ci/scripts/r_windows_build.sh line 22:
: ${ARROW_HOME:=$(pwd)}
  ^-------------------^ SC2223 (info): This default assignment may cause DoS due to globbing. Quote it.


In ci/scripts/r_windows_build.sh line 24:
export ARROW_HOME="$(cd "${ARROW_HOME}" && pwd)"
       ^--------^ SC2155 (warning): Declare and assign separately to avoid masking return values.


In ci/scripts/r_windows_build.sh line 28:
RWINLIB_LIB_DIR="lib"
^-------------^ SC2034 (warning): RWINLIB_LIB_DIR appears unused. Verify use (or export if used externally).


In ci/scripts/r_windows_build.sh line 29:
: ${MINGW_ARCH:="mingw32 mingw64 ucrt64"}
  ^-- SC2223 (info): This default assignment may cause DoS due to globbing. Quote it.


In ci/scripts/r_windows_build.sh line 33:
cp $ARROW_HOME/ci/scripts/PKGBUILD .
   ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
cp "$ARROW_HOME"/ci/scripts/PKGBUILD .


In ci/scripts/r_windows_build.sh line 37:
VERSION=$(grep Version $ARROW_HOME/r/DESCRIPTION | cut -d " " -f 2)
                       ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
VERSION=$(grep Version "$ARROW_HOME"/r/DESCRIPTION | cut -d " " -f 2)


In ci/scripts/r_windows_build.sh line 50:
ls *.xz | xargs -n 1 tar -xJf
^-- SC2011 (warning): Use 'find .. -print0 | xargs -0 ..' or 'find .. -exec .. +' to allow non-alphanumeric filenames.
   ^-- SC2035 (info): Use ./*glob* or -- *glob* so names with dashes won't become options.


In ci/scripts/r_windows_build.sh line 51:
mkdir -p $DST_DIR
         ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
mkdir -p "$DST_DIR"


In ci/scripts/r_windows_build.sh line 54:
if [ ! -d $DST_DIR/include ]; then
          ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
if [ ! -d "$DST_DIR"/include ]; then


In ci/scripts/r_windows_build.sh line 55:
  mv $(echo $MINGW_ARCH | cut -d ' ' -f 1)/include $DST_DIR
     ^-- SC2046 (warning): Quote this to prevent word splitting.
            ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                   ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  mv $(echo "$MINGW_ARCH" | cut -d ' ' -f 1)/include "$DST_DIR"


In ci/scripts/r_windows_build.sh line 63:
  ls $MSYS_LIB_DIR/mingw64/lib/
     ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  ls "$MSYS_LIB_DIR"/mingw64/lib/


In ci/scripts/r_windows_build.sh line 65:
  mkdir -p $DST_DIR/lib/x64
           ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  mkdir -p "$DST_DIR"/lib/x64


In ci/scripts/r_windows_build.sh line 67:
  mv mingw64/lib/*.a $DST_DIR/lib/x64
                     ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  mv mingw64/lib/*.a "$DST_DIR"/lib/x64


In ci/scripts/r_windows_build.sh line 69:
  cp $MSYS_LIB_DIR/mingw64/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a $DST_DIR/lib/x64
     ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                                                       ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  cp "$MSYS_LIB_DIR"/mingw64/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a "$DST_DIR"/lib/x64


In ci/scripts/r_windows_build.sh line 74:
  ls $MSYS_LIB_DIR/mingw32/lib/
     ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  ls "$MSYS_LIB_DIR"/mingw32/lib/


In ci/scripts/r_windows_build.sh line 75:
  mkdir -p $DST_DIR/lib/i386
           ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  mkdir -p "$DST_DIR"/lib/i386


In ci/scripts/r_windows_build.sh line 76:
  mv mingw32/lib/*.a $DST_DIR/lib/i386
                     ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  mv mingw32/lib/*.a "$DST_DIR"/lib/i386


In ci/scripts/r_windows_build.sh line 77:
  cp $MSYS_LIB_DIR/mingw32/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a $DST_DIR/lib/i386
     ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                                                       ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  cp "$MSYS_LIB_DIR"/mingw32/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a "$DST_DIR"/lib/i386


In ci/scripts/r_windows_build.sh line 82:
  ls $MSYS_LIB_DIR/ucrt64/lib/
     ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  ls "$MSYS_LIB_DIR"/ucrt64/lib/


In ci/scripts/r_windows_build.sh line 83:
  mkdir -p $DST_DIR/lib/x64-ucrt
           ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  mkdir -p "$DST_DIR"/lib/x64-ucrt


In ci/scripts/r_windows_build.sh line 84:
  mv ucrt64/lib/*.a $DST_DIR/lib/x64-ucrt
                    ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  mv ucrt64/lib/*.a "$DST_DIR"/lib/x64-ucrt


In ci/scripts/r_windows_build.sh line 85:
  cp $MSYS_LIB_DIR/ucrt64/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a $DST_DIR/lib/x64-ucrt
     ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                                                      ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  cp "$MSYS_LIB_DIR"/ucrt64/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a "$DST_DIR"/lib/x64-ucrt


In ci/scripts/r_windows_build.sh line 89:
zip -r ${DST_DIR}.zip $DST_DIR
       ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                      ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
zip -r "${DST_DIR}".zip "$DST_DIR"


In ci/scripts/r_windows_build.sh line 93:
cp ${DST_DIR}.zip ../libarrow.zip
   ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
cp "${DST_DIR}".zip ../libarrow.zip

For more information:
  https://www.shellcheck.net/wiki/SC2011 -- Use 'find .. -print0 | xargs -0 ....
  https://www.shellcheck.net/wiki/SC2034 -- RWINLIB_LIB_DIR appears unused. V...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...

What changes are included in this PR?

  • SC2011: Replace ls | xargs with find -print0/-exec for safe filename handling.
  • SC2034: Remove or export unused variables.
  • SC2035: Prefix globs with ./ (or --) to avoid option misinterpretation.
  • SC2046: Quote command substitutions to prevent word splitting.
  • SC2086: Quote variable expansions to prevent globbing and word splitting.
  • SC2155: Separate variable declaration from assignment.
  • SC2223: Quote parameter expansion in default assignments to prevent globbing.

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

@github-actions github-actions Bot added the awaiting review Awaiting review label Aug 6, 2026
@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

@github-actions crossbow submit r-binary-packages

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Revision: 4c22cd7

Submitted crossbow builds: ursacomputing/crossbow @ actions-c122511f11

Task Status
r-binary-packages GitHub Actions

@kou kou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@kou
kou merged commit 20300f8 into apache:main Aug 6, 2026
43 checks passed
@kou kou removed the awaiting review Awaiting review label Aug 6, 2026
@github-actions github-actions Bot added the awaiting merge Awaiting merge label Aug 6, 2026
@hiroyuki-sato
hiroyuki-sato deleted the topic/shellcheck-r_windows_build branch August 6, 2026 08:58
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 20300f8.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 1 possible false positive for unstable benchmarks that are known to sometimes produce them.

@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 20300f8.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 1 possible false positive for unstable benchmarks that are known to sometimes produce them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge Awaiting merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants